uniform sampler2D   staticTexture;
uniform sampler2D   dynamicTexture;

void main() {
    vec4 dynamicTextureColor = texture2D( dynamicTexture, gl_TexCoord[0].st );

    gl_FragColor = dynamicTextureColor;
    gl_FragColor.a = min( texture2D( staticTexture, gl_TexCoord[0].st ).a, dynamicTextureColor.a );
}